bitkeeper revision 1.1159.170.92 (41e64706rQEeEkbb1iQ8WhbAgZNBFQ)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 13 Jan 2005 10:01:42 +0000 (10:01 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Thu, 13 Jan 2005 10:01:42 +0000 (10:01 +0000)
Clean up string functions (memcpy/memset).

xen/common/string.c
xen/include/asm-x86/x86_32/string.h

index bf9595d75b925981f0c7480f11a0ce254eb338f6..c49d32deb0545896e70970b47ac13a5d87bc02ce 100644 (file)
@@ -391,6 +391,7 @@ char * bcopy(const char * src, char * dest, int count)
 }
 #endif
 
+#ifndef __HAVE_ARCH_MEMCPY
 /**
  * memcpy - Copy one area of memory to another
  * @dest: Where to copy to
@@ -400,7 +401,6 @@ char * bcopy(const char * src, char * dest, int count)
  * You should not use this function to access IO space, use memcpy_toio()
  * or memcpy_fromio() instead.
  */
-#undef memcpy
 void * memcpy(void * dest,const void *src,size_t count)
 {
        char *tmp = (char *) dest, *s = (char *) src;
@@ -410,6 +410,7 @@ void * memcpy(void * dest,const void *src,size_t count)
 
        return dest;
 }
+#endif
 
 #ifndef __HAVE_ARCH_MEMMOVE
 /**
index 27fbb4d035b517170d75e3c09f26bd81a0212e23..43fad09eeaa8213da512db8178f93ea2c756d230 100644 (file)
@@ -206,7 +206,7 @@ return (to);
  * This looks horribly ugly, but the compiler can optimize it totally,
  * as the count is constant.
  */
-static inline void * __constant_memcpy(void * to, const void * from, size_t n)
+static always_inline void * __constant_memcpy(void * to, const void * from, size_t n)
 {
        switch (n) {
                case 0:
@@ -272,12 +272,13 @@ __asm__ __volatile__( \
 }
 
 #define __HAVE_ARCH_MEMCPY
-
-#define memcpy(t, f, n) \
-(__builtin_constant_p(n) ? \
- __constant_memcpy((t),(f),(n)) : \
- __memcpy((t),(f),(n)))
-
+static always_inline __attribute_used__
+void memcpy(void *t, const void *f, size_t n)
+{
+       (__builtin_constant_p(n) ?
+        __constant_memcpy((t),(f),(n)) :
+        __memcpy((t),(f),(n)));
+}
 
 /*
  * struct_cpy(x,y), copy structure *x into (matching structure) *y.
@@ -410,7 +411,7 @@ return __res;
  * This looks horribly ugly, but the compiler can optimize it totally,
  * as we by now know that both pattern and count is constant..
  */
-static inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
+static always_inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
 {
        switch (count) {
                case 0: